{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import pandas as pd\n",
    "\n",
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "\n",
    "# set font for graphs\n",
    "plt.rcParams['font.serif'] = \"CMU Serif\"\n",
    "plt.rcParams['font.family'] = \"serif\"\n",
    "plt.rcParams['mathtext.fontset'] = 'custom'\n",
    "plt.rcParams['mathtext.rm'] = \"CMU Serif\"\n",
    "plt.rcParams['mathtext.it'] = \"CMU Serif:italic\"\n",
    "plt.rcParams['mathtext.bf'] = \"CMU Serif:bold\"\n",
    "plt.rcParams['text.usetex'] = True\n",
    "\n",
    "# set path\n",
    "path = \"path/to/analysis/output_figures/\"\n",
    "path_data = \"path/to/analysis/output_figure_data/\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "# parameters that apply to all \n",
    "y = 2.5\n",
    "X = 2.1\n",
    "m = 0.2\n",
    "e = 1\n",
    "s = 1\n",
    "kappa = 5 # rho = f(x), f(x) = kappa * x^alpha\n",
    "α = 0.5\n",
    "θ = 0.6\n",
    "ℓ = 0.12\n",
    "δ = 0.1\n",
    "ξ = 0.7\n",
    "λ_hat = (X*(ℓ+ξ*(1-ℓ))-ξ)/(X-ξ)\n",
    "λ_bar = ℓ + (1-ℓ)*ξ\n",
    "\n",
    "λ = np.linspace(0.1, 1, 1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "# assume F(X) = X^α -> F'(X) = α X ^(α-1)\n",
    "ρ = α *kappa*(e-(m/(1-m))*(1-λ)*s)**(α-1)\n",
    "\n",
    "R = (y-m*ρ)/(1-m) * (1/θ)\n",
    "\n",
    "# redemptions and investor payoffs; equation 11\n",
    "region1 = θ * R + (1-θ) * np.maximum((ℓ-λ)/(1-λ),0) - 1\n",
    "region2 = θ * ((X*(1-ℓ)* (1-(λ-ℓ)/(ξ*(1-ℓ))))/(1-λ)) - 1\n",
    "region3 = -1*(ℓ+(1-ℓ)*ξ)/(λ)\n",
    "               \n",
    "ν = np.empty_like(λ)               \n",
    "      \n",
    "ν[(δ <= λ) & (λ <= λ_hat)] = region1[(δ <= λ) & (λ <= λ_hat)]\n",
    "ν[(λ_hat<λ) & (λ <= λ_bar)] = region2[(λ_hat<λ) & (λ <= λ_bar)]\n",
    "ν[(λ_bar<λ) & (λ <= 1)] = region3[(λ_bar<λ) & (λ <= 1)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAh4AAAEiCAYAAAC2k9sBAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAApuUlEQVR4nO3df3xbd33v8bf8I0oTx1aUNqVpTNPj/qBAgcg2UAqlLHJbYHeXtXbCNgZsq2W2sd0tW+O63DvogKpJt/vg3rELUtiDDdhYLDX7TQGrKb+6Ql2ftONHS4tOQltS6A9ZVpImTmzr/uH6VLItW5Klox9+PR+PPJxz9JXOJyd++Lz9/X7P97jS6XRaAAAADmiodAEAAGD1IHgAAADHEDwAAIBjCB4AAMAxBA8AAOAYggcAAHAMwQMAADimqdIFVJOZmRkdO3ZMGzZskMvlqnQ5AADUjHQ6rePHj2vLli1qaMjdr0HwyHDs2DG1t7dXugwAAGrWU089pa1bt+Z8neCRYcOGDZJmT1pra2uFqwEAoHakUim1t7fb19JcCB4Z5oZXWltbCR4AABRhuakKNTG51DRNdXZ25tXONE1JkmVZ9t8BAEB1qPrgEY1GJSmvEBEKhdTZ2SmXy6WBgQEZhlHu8gAAQAGqfqilt7c377adnZ0aHx+XJHk8njJVBAAAilX1waN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1ntX3jhBc77Cs0PbvO/1zPN//8pBx4St8pZlqVQKKTu7m6Njo5mLU7V19en7u5u7dmzR5ZlqaOjI+u9Ho9H4+PjFai69uV73uckk0mFw2ENDg4qEAgQPopUyHlPJpMaHBxUZ2enxsbG7J4+FK6Q8x6LxWSapv263+/nvBchFotpZGRE+/bt0549e9Td3W1P1J1/zpf6/ykHggcAAHAMQy0AAMAxBA8AAOAYggcAAHAMwQMAADiG4AEAABxD8AAAAI4heAAAAMcQPABUPcuy1NPTw9LZQB0geACoenPLlQeDwUqXAmCFWLkUQE2wLEudnZ0s0w/UOHo8ANQEwzDk9Xp5Mi9Q4wgeAGrGwMCAQqFQpcsAsAIEDwA1w+PxaHh4uNJlAFgBggeAmhAOh2UYhgzDUCwWq3Q5AIpE8ABQ9cLhsCTJ7/dr165dDLcANYy7WgBUtXA4rLGxMTtsJJNJbdy4UfzoAmoTPR4AqlYymVQkEsnq4fB4POrt7VU0Gq1gZQCKRY8HAABwDD0eAADAMQQPAADgGIIHAABwDMEDAAA4huABAAAcQ/AAAACOIXgAAADHEDwAAIBjCB4AAMAxBA8AAOAYggcAAHDM/we4jSbhVE2APgAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 600x300 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# plot by splitting the λ and ν into three parts\n",
    "\n",
    "λ_region1 = λ[(δ <= λ) & (λ <= λ_hat)]\n",
    "λ_region2 = λ[(λ_hat<λ) & (λ <= λ_bar)]\n",
    "λ_region3 = λ[(λ_bar<λ) & (λ <= 1)]\n",
    "\n",
    "ν_region1 = ν[(δ <= λ) & (λ <= λ_hat)]\n",
    "ν_region2 = ν[(λ_hat<λ) & (λ <= λ_bar)]\n",
    "ν_region3 = ν[(λ_bar<λ) & (λ <= 1)]\n",
    "\n",
    "\n",
    "plt.rcParams[\"figure.figsize\"] = (6,3)\n",
    "\n",
    "plt.plot(λ_region1, ν_region1, 'k-', label=r'$\\lambda \\in [ \\delta, \\hat{\\lambda}]$', color=\"#0072B2\")  # solid line\n",
    "plt.plot(λ_region2, ν_region2, 'k--', label=r'$\\lambda \\in (\\hat{\\lambda}, \\bar{\\lambda}]$', color=\"#0072B2\")  # dashed line\n",
    "plt.plot(λ_region3, ν_region3, 'k:', label=r'$\\lambda \\in (\\bar{\\lambda}, 1]$', color=\"#0072B2\")  # dot dash line\n",
    "plt.axhline(y =0, color = 'black', linestyle = '-')\n",
    "\n",
    "plt.xlabel(r'$\\lambda$')\n",
    "plt.ylabel(r'$\\nu(\\theta, \\lambda)$')\n",
    "plt.legend()\n",
    "plt.rcParams['axes.unicode_minus'] = False\n",
    "plt.legend(fancybox=True, frameon=False)\n",
    "\n",
    "plt.legend(fancybox=True, frameon=False)\n",
    "plt.savefig(path+\"figure_v.pdf\", format='pdf', dpi=2400,bbox_inches='tight')\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "leverage_and_stablecoin_pegs",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
